from keras.layers import Input, Embedding, Conv1D, Dense, Dropout, GlobalMaxPooling1D, Concatenate, LSTM, TimeDistributed
from keras.models import Model
from tensorflow import keras as K
from keras import optimizers


def create_net(embedding_dim, char_size, num_filters, hidden_dim, input_length, output_dim):
    input_char = Input(shape=(input_length, ), name='input_char')
    char_embeding = Embedding(output_dim=embedding_dim, input_dim=char_size, input_length=input_length,
                              name='char_embeding')(input_char)
    x = LSTM(num_filters, return_sequences=True)(char_embeding)
    x = LSTM(num_filters, return_sequences=True)(x)
    x = LSTM(num_filters, return_sequences=False)(x)
    x = Dense(units=hidden_dim, activation=K.backend.relu)(x)
    output = Dense(units=output_dim, activation=K.backend.softmax)(x)

    print(output)
    model = Model(inputs=[input_char,
                          # input_word
                          ], outputs=output)


    model.summary()
    nadam = optimizers.Nadam()
    model.compile(optimizer=nadam,
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])
    return model
